#ifndef _USART_H_
#define _USART_H_

#include "board.h"
#include "stdarg.h"
#include "stdio.h"
#include "string.h"

#define U0_TX_SIZE  2048
#define U0_RX_SIZE  2048
#define U0_RX_MAX   256
#define NUM         10

#define USART0_DMA_CH   DMA_CH4

typedef struct
{
    uint8_t *start;
    uint8_t *end;
}UCB_URxBuffptr;


typedef struct
{
    uint16_t URxCounter;
    UCB_URxBuffptr  URxDataPtr[NUM];
    UCB_URxBuffptr *URxDataIN;
    UCB_URxBuffptr *URxDataOUT;
    UCB_URxBuffptr *URxDataEND;
}UCB_CB;

extern uint8_t U0_RxBuff[U0_RX_SIZE];
extern UCB_CB U0CB;


void Usart0_Init(uint32_t Bandrate);
void debug_printf(char *format,...);


#endif

